package com.meida.module.bus.provider.service.impl;

import com.meida.common.mybatis.base.service.impl.BaseServiceImpl;
import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.model.ResultBody;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.module.bus.client.entity.srmapi.basedata.SrmMaterial;
import com.meida.module.bus.provider.mapper.srm.SrmMaterialMapper;
import com.meida.module.bus.provider.service.SrmMaterialService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class SrmMaterialServiceImpl extends BaseServiceImpl<SrmMaterialMapper, SrmMaterial> implements SrmMaterialService{


    @Override
    public ResultBody beforePageList(CriteriaQuery<SrmMaterial> cq, SrmMaterial srmMaterial, EntityMap requestMap) {
        String valueKey = requestMap.get("valueKey");
        String value = requestMap.get("value");
        cq.addSelect("concat(materialCode,' ',materialName) as materialCode");
        cq.like("concat(materialCode,materialName)", value);
        return super.beforePageList(cq, srmMaterial, requestMap);
    }
}
